﻿using Mes.Domain.BoundedContext.EntityBase;

namespace Mes.Domain.BoundedContext.Entities.WorkOrders
{
    /// <summary>
    /// 工单
    /// </summary>
    public class Wo : NoIdEntityBase
    {
        /// <summary>
        /// Constructor
        /// </summary>
        public Wo() { }

        ///// <summary>
        ///// Constructor
        ///// </summary>
        ///// <param name="processId"></param>
        ///// <param name="woId"></param>
        ///// <param name="woDesc"></param>
        ///// <param name="itemId"></param>
        ///// <param name="bomVerId"></param>
        ///// <param name="startQty"></param>
        ///// <param name="reqQty"></param>
        ///// <param name="releaseTimeLocal"></param>
        ///// <param name="reqFinishTimeLocal"></param>
        ///// <param name="woPriority"></param>
        ///// <param name="notes"></param>
        ///// <param name="stateCd"></param>
        public Wo(string processId, string woId, string? woDesc, int itemId, string? bomVerId, double startQty, double reqQty, int woPriority, DateTime? releaseTimeLocal,
            DateTime? reqFinishTimeLocal, string? notes, int stateCd)
        {
            Process_Id = processId;
            Wo_Id = woId;
            Wo_Desc = woDesc;
            Item_Id = itemId;
            Bom_Ver_Id = bomVerId;
            Start_Qty = startQty;
            Req_Qty = reqQty;
            Wo_Priority = woPriority;
            Release_Time_Local = releaseTimeLocal;
            Req_Finish_Time_Local = reqFinishTimeLocal;
            Notes = notes;
            State_Cd = stateCd;
        }

        public string Wo_Id { get; set; } = string.Empty;

        public string? Wo_Desc { get; set; }

        public string? Process_Id { get; set; }

        public string? Bom_Ver_Id { get; set; }

        public string? Spec_Ver_Id { get; set; }

        public int Item_Id { get; set; }

        public double Start_Qty { get; set; }

        public double Req_Qty { get; set; }

        public DateTime? Release_Time_Utc { get; set; }

        public DateTime? Release_Time_Local { get; set; }

        public DateTime? Req_Finish_Time_Utc { get; set; }

        public DateTime? Req_Finish_Time_Local { get; set; }

        //0 = Released, 1 = Started, 2 = Completed, 3 = Closed
        public int State_Cd { get; set; }

        public int Wo_Priority { get; set; }

        public string? Cust_Info { get; set; }

        public string? Mo_Id { get; set; }

        public string? Production_Schedule_Id { get; set; }

        public string? Notes { get; set; }

        public bool Not_Deletable { get; set; }

        public bool Disassembly { get; set; }

        public bool May_Override_Route { get; set; }

        public bool Override_Serialization { get; set; }

        public string? Input_Wo_Id { get; set; }

        public string? Input_Oper_Id { get; set; }

        public int? Input_Seq_No { get; set; }

        public int? Target_Sched_Line_Id { get; set; }

        public int? Queue_Seq_No { get; set; }

        public string? Spare1 { get; set; }

        public string? Spare2 { get; set; }

        public string? Spare3 { get; set; }

        public string? Spare4 { get; set; }

        public string? Last_Edit_Comment { get; set; }

        public string? Last_Edit_By { get; set; }

        public DateTime Last_Edit_At { get; set; }

        public long Mod_Id { get; set; }

        public int Row_Id { get; set; }
    }
}
